<template>
  <div class="list-pagination">
    <el-pagination
      v-model:current-page="pages.currentPage"
      v-model:page-size="pages.pagesize"
      :page-sizes="[5, 20, 50, 100]"
      :small="small"
      :disabled="disabled"
      :background="background"
      layout="total, sizes, prev, pager, next, jumper"
      :total="tableData.length"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
const props = defineProps(["pages", "tableData"]);
const emits = defineEmits(["presentPages"]);
const small = ref(false);
const disabled = ref(false);
const background = ref(true);
const pages = props.pages;
const tableData = props.tableData;
const handleSizeChange = (size: number) => {
  pages.pagesize = size;
  emits("presentPages", pages);
};
const handleCurrentChange = (currentPage: number) => {
  pages.currentPage = currentPage;
  emits("presentPages", pages);
};
</script>

<style lang="scss" scoped>
.list-pagination {
  display: flex;
  flex-direction: row-reverse;
  margin-top: 20px;
  padding-right: 50px;
}
</style>
